package com.ehotting.edsta.circuitDesign.gen.circuit.script;

import com.ehotting.edsta.circuitDesign.domain.EsRuleScript;
import com.ehotting.edsta.circuitDesign.gen.arguments.script.ArgumentsScriptAbstract;
import com.ehotting.edsta.circuitDesign.gen.element.enums.ScriptTypeEnum;
import org.springframework.stereotype.Component;

import java.util.List;
import java.util.Map;

@Component
public class CustomCircuitScript extends CircuitScriptAbstract {

    @Override
    public String invoke(EsRuleScript esRule, List<String> argumentsList,  String functionName) {
        // 1、定义方法头部
        StringBuffer buf = new StringBuffer(functionStart( functionName, argumentsList));

        buf.append(esRule.getContent());

        // 1、方法结束
        buf.append(this.functionEnd());
        return buf.toString();
    }


    @Override
    public boolean isTrue(ScriptTypeEnum code){
        return ScriptTypeEnum.CUSTOM == code;
    }

    @Override
    public String getExample() {
        return null;
    }
}
